{% extends 'base.html' %}
{% load static %}
{% block title %}测试集合执行结果{% endblock %}

{% block content %}

<div class="table-responsive">
    <table class="table table-striped">
        <thead>
        <tr>
            <th>id</th>
            <th>测试集合名称</th>
            <th>延迟执行时间</th>
            <th>执行状态</th>
            <th>测试结果</th>
            <th>测试结果统计</th>
            <th>创建者</th>
            <th>创建时间</th>
        </tr>
        </thead>
        <tbody>

        {% for case_suite_execute_record in case_suite_execute_records %}
        <tr>
            <td>{{ case_suite_execute_record.id }}</td>
            <td><a href="{% url 'suite_case_execute_record' case_suite_execute_record.id %}">{{ case_suite_execute_record.case_suite.suite_desc }}</a></td>
            <td>{{ case_suite_execute_record.run_time_interval }}</td>
            {% if case_suite_execute_record.status %}
            <td>执行完毕</td>
            {% else %}
            <td>待执行</td>
            {% endif %}

            {% ifequal case_suite_execute_record.test_result '成功' %}
            <td bgcolor='green'>{{ case_suite_execute_record.test_result}}</td>
            {% else %}
            <td bgcolor='red'>{{ case_suite_execute_record.test_result}}</td>
            {% endifequal %}
            <td><a href="{% url 'suite_case_statistics' case_suite_execute_record.id %}">测试结果统计</a></td>
            <td>{{ case_suite_execute_record.creator }}</td>
            <td>{{ case_suite_execute_record.create_time|date:"Y-n-d H:i" }}</td>
        </tr>
        {% endfor %}


        </tbody>
    </table>
</div>

{# 实现分页标签的代码 #}
{# 这里使用 bootstrap 渲染页面 #}
<div id="pages" class="text-center">
    <nav>
        <ul class="pagination">
            <li class="step-links">
                {% if case_suite_execute_records.has_previous %}
                <a class='active' href="?page={{ case_suite_execute_records.previous_page_number }}">上一页</a>
                {% endif %}

                <span class="current">
                    第 {{ case_suite_execute_records.number }} 页 / 共 {{ case_suite_execute_records.paginator.num_pages }} 页</span>

                {% if case_suite_execute_records.has_next %}
                <a class='active' href="?page={{ case_suite_execute_records.next_page_number }}">下一页</a>
                {% endif %}
            </li>
        </ul>
    </nav>
</div>
{% endblock %}
